#include <string>
#include <vector>
#include <fstream>

using namespace std;


class csvfile {
	public:
		csvfile();
		csvfile(const char* path, char delim, int skip=0);

		void load(const char* path, char delim, int skip=0);
		void save(const char* path, char delim = ',');

		float get(int x, int y)							{ return data[y][x];	}
		void  set(int x, int y, float val)	{ data[y][x] = val;		}
		
		float*	getbuffer(int row)	{ return &(data[row][0]); }
		int			getlength(int row)	{ return data[row].size();}
		int			getsize()						{ return data.size();			}

		vector<vector<float> >& getdata() { return data; }

		static const string delimiters;

		bool isValid() { return valid;}

	private:

		vector<vector<float> > data;
		bool valid;
};

